package cn.itrip.auth.service;

import cn.itrip.pojo.ItripUser;
import cn.itrip.vo.ItripTokenVO;

public interface TokenService {

    /**
     * token有效期
     */
    Long SESSION_TIMEOUT= 2*60*60L;

    Long REPLACEMENT_PROTECTION_TIMEOUT = 1*60*60*1000L;

    Long REPLACEMENT_DELAY = 2*60*1000L;
    /**
     * 生成token
     * @param agent
     * @param itripUser
     * @return
     */
    String createToken(String agent, ItripUser itripUser) throws Exception;

    /**
     * 保存token
     * @param token
     * @param user
     */
    void save(String token, ItripUser user);

    /**
     * 验证token，并返回相应的token
     * @return
     */
    ItripTokenVO verifyToken(String agent, String token) throws Exception;


     /**注销  删除token1
     * @Param token
     */
    public void logout(String token) throws Exception;

    /**
     * 验证token是否存在
     */
    public boolean exitToken(String agent,String token)throws Exception;
}
